package com.ml.mall.model.mail.admin;

import com.ml.mall.bean.vo.OrderDetailArrVO;
import com.ml.mall.model.MailMessage;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @description 该工具类为管理员添加邮件发送模板
 * @author pl
 * @date 2021/7/13
 * @version 1.0
*/
@Component
public class MailTempleteForAdmin {


    /**
     * * needCheck（修改触发点为：用户点击邮件链接的时候）//ok
     * 卖家注册后，系统发送 “卖家注册邮件” 给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getSupplierRegistration(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("New supplier has registered in the system.");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                New <span style=\"color: #54af9a;\">supplier</span> has registered in the system\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong>[ admin_name ],</strong></p>\n" +
                "        <br>\n" +
                "        <p>Supplier <strong> company_name </strong> is now registered in the system.</p>\n" +
                "        <p>Please view the details for approval.</p>\n" +
                "        <a href = system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");

        return mailMessage;
    }

    /**
     * * needCheck（修改触发点为：用户点击邮件链接的时候）//ok
     * 买家注册后，系统发送 “买家注册邮件” 给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getPurchaserRegistration(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("New purchaser has registered in the system.");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                New <span style=\"color: #54af9a;\">purchaser</span> has registered in the system\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong>[ admin_name ],</strong></p>\n" +
                "        <br>\n" +
                "        <p>Purchaser <strong> company_name </strong> is now registered in the system.</p>\n" +
                "        <p>Please view the details for approval.</p>\n" +
                "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "  </div>\n" +
                "</div>");

        return mailMessage;
    }

    /**
     * 新合伙人加入，系统发送 “新合伙人加入” 邮件给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getPartnerOnBoard(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("New partner has registered for the system.");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                <span style=\"color: #54af9a;\">Partner</span> has joined Airena Procurement System\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong>[ admin_name ],</strong></p>\n" +
                "        <br>\n" +
                "        <p>Partner <strong> company_name </strong> is now registered in the system.</p>\n" +
                "                <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");

        return mailMessage;
    }

    /**
     * needCheck（该邮件是否被触发；如果没有触发需要在订单创建的时候触发）//ok(用的自己写的模板)
     使用买家订单
     */
    public MailMessage getNewPurchaseOrder(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("New purchase order [ purchase_order_no ] has been made.");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                New purchase order <span style=\"color: #54af9a;\">[ purchase_order_no ]</span> has been made\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong>[ admin_name ],</strong></p>\n" +
                "        <br>\n" +
                "        <p>New purchase order <strong>[ purchase_order_no ]</strong> has been made by purchaser <strong> company_name </strong>.</p>\n" +
                "        <div style=\"background-color: #EFF2F4\">\n" +
                "            <h4>Products</h4>\n" +
                "            <div class=\"supplier-products-info\">\n" +
                "                <div style=\"display: inline-block; width: 25%;\">\n" +
                "                <strong>[ supplier_name ]</strong>\n" +
                "                </div>\n" +
                "                <div style=\"display: inline-block;\">\n" +
                "                <strong>Status</strong> : [ delivery_status ]\n" +
                "                </div>\n" +
                "                <div style=\"display: inline-block;\">\n" +
                "                <strong>Delivery Date </strong> : [ delivery_date ]\n" +
                "                </div>\n" +
                "                <div style=\"display: inline-block;\">\n" +
                "                <strong>Tracking Code</strong> : [ tracking_code ]\n" +
                "                </div>\n" +
                "            </div>\n" +
                "            <div class=\"supplier-product-table\" style=\"padding-top: 20px; padding-bottom: 30px; border-bottom: solid 0.5px #D4DAE6;\">\n" +
                "                <table style=\"width: 100%; border-radius: 5px; border-collapse: collapse;\">\n" +
                "                <tr><th style=\"width: 15%; padding: 5px 10px;\">Image</th><th style=\"width: 40%;text-align: left;\">Product Name</th><th style=\"width: 10%;text-align: center;\">Quantity</th><th style=\"width: 15%;text-align: right;\">Unit Price</th><th style=\"width: 10%;text-align: right; padding-right: 10px;\">Total</th></tr>\n" +
                "                <tr style=\"background-color: #DCE5F2; border-radius: 10px;\">\n" +
                "                    <td style=\"border: none; padding: 10px 0 10px 10px;\">\n" +
                "                        <img src=\"..\" style=\"width: 75px; height: 75px;\">\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none;\">\n" +
                "                        [ product_name ]\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: center;\">\n" +
                "                        [ quantity ]\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: right;\">\n" +
                "                        <div style=\"padding-bottom: 5px;\">RM [ price ]</div>\n" +
                "                        <div style=\"padding-bottom: 5px;\">RM [ sales_price ]</div>\n" +
                "                        <div>RM [ uom ]</div>\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: right; padding-right: 10px;\">\n" +
                "                        RM [ total ]\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"border-radius: 10px;\">\n" +
                "                    <td style=\"border: none; padding: 10px 0 10px 10px;\">\n" +
                "                        <img src=\"..\" style=\"width: 75px; height: 75px;\">\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none;\">\n" +
                "                        [ product_name ]\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: center;\">\n" +
                "                        [ quantity ]\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: right;\">\n" +
                "                        <div style=\"padding-bottom: 5px;\">RM [ price ]</div>\n" +
                "                        <div style=\"padding-bottom: 5px;\">RM [ sales_price ]</div>\n" +
                "                        <div>RM [ uom ]</div>\n" +
                "                    </td>\n" +
                "                    <td style=\"border: none; text-align: right; padding-right: 10px;\">\n" +
                "                        RM [ total ]\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"border-radius: 10px; font-weight: bold;\">\n" +
                "                    <td colspan=\"4\" style=\"text-align: right;\">\n" +
                "                        <div>Delivery Fee (Delivered by [ logistic_company_name ]) :</div>\n" +
                "                        <div style=\"padding: 5px\">\n" +
                "                            <div style=\"display: inline-block; width: 100px; font-size: 13px; padding-left: 5px; float: right; vertical-align: middle; line-height: 30px;\">\n" +
                "                                ([coupon_desc])\n" +
                "                            </div>\n" +
                "                            <div style=\"background-color: #2C84EA; border-radius: 5px; width: 100px; font-size: 13px; padding: 5px; float: right; display: inline-block;\">\n" +
                "                                <span style=\"color: white;\">[coupon_name]</span>\n" +
                "                                \n" +
                "                            </div>\n" +
                "                        </div>\n" +
                "                    </td>\n" +
                "                    <td style=\"text-align: right; font-size: 13px; padding-right: 10px; padding-bottom: 10px;\">\n" +
                "                        <div class=\"delivery_fee\">\n" +
                "                            RM [delivery_fee]\n" +
                "                        </div>\n" +
                "                        <div>\n" +
                "                            - RM [coupon_fee]\n" +
                "                        </div>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                </table>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "        <div style=\"background-color: #EFF2F4;padding-bottom: 20px;\">\n" +
                "            <table style=\"width: 100%; border-radius: 5px; border-collapse: collapse;\">\n" +
                "                <tr>\n" +
                "                <td style=\"width: 45%;text-align: left\">\n" +
                "                    <div style=\"padding-bottom: 5px\">\n" +
                "                        <span style=\"font-weight: bold;\">Delivery Note</span>\n" +
                "                    </div>\n" +
                "                    <div style=\"padding-bottom: 10px\">\n" +
                "                        <textarea rows=\"5\" cols=\"60\" readonly style=\"border-radius: 5px; resize: none;\">[ delivery_note ]</textarea>\n" +
                "\n" +
                "                    </div>\n" +
                "                </td>\n" +
                "                <th style=\"width: 55%; text-align: right;\">\n" +
                "                    <table style=\"width: 100%; font-size:13px\">\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Sub total</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">RM [sub_total]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Coupon</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\">\n" +
                "                                <div style=\"padding-bottom: 5px\">\n" +
                "                                <div style=\"display: inline-block; width: 100px; font-size: 13px; padding-left: 5px; float: right; vertical-align: middle; line-height: 30px;\">\n" +
                "                                    ([coupon_desc])\n" +
                "                                </div>\n" +
                "                                <div style=\"background-color: #F5537F; border-radius: 5px; width: 100px; font-size: 13px; padding: 5px; float: right; display: inline-block;\">\n" +
                "                                    <span style=\"color: white;\">[coupon_name]</span>\n" +
                "                                </div>\n" +
                "                                </div>\n" +
                "                            </td>\n" +
                "                            <td style=\"width: 25%;\">- RM [coupon_amt]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Delivery Fee</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">RM [delivery_fee]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Shipping Coupon</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">- RM [shipping_coupon]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Adjustment</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">RM [adjustment]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Credit</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">- RM [sub_total]</td>\n" +
                "                        </tr>\n" +
                "                        <tr>\n" +
                "                            <td style=\"width: 25%; text-align: left;\">Total (Incl. Tax)</td>\n" +
                "                            <td style=\"width: 5%\">:</td>\n" +
                "                            <td style=\"width: 45%\"></td>\n" +
                "                            <td style=\"width: 25%;\">RM [total_amt]</td>\n" +
                "                        </tr>\n" +
                "\n" +
                "                    </table>\n" +
                "                </th>\n" +
                "                </tr>\n" +
                "            </table>\n" +
                "        </div>\n" +
                "        <br>\n" +
                "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "\n" +
                "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");

        return mailMessage;
    }


    private String forOrderStateBySupplier(List<OrderDetailArrVO> orderDetailArrVOS){

        StringBuilder sb = new StringBuilder();
        if(orderDetailArrVOS!=null&&orderDetailArrVOS.size()>0) {
            for (OrderDetailArrVO vo : orderDetailArrVOS) {
                String str =
                        "<tr style=\"background-color: #DCE5F2; border-radius: 10px;\">\n" +
                                "                     <td style=\"border: none; padding: 10px 0 10px 10px;\">\n" +
                                "                        <img src=\"..\" style=\"width: 75px; height: 75px;\">\n" +
                                "                    </td>\n" +
                                "                    <td style=\"border: none;\">\n" +
                                "                        [ "+vo.getVariantName()+ " ]\n" +
                        "                    </td>\n" +
                        "                    <td style=\"border: none; text-align: center;\">\n" +
                        "                        [ "+vo.getQuantity()+" ]\n" +
                        "                    </td>\n" +
                        "                    <td style=\"border: none; text-align: right;\">\n" +
                        "                        <div style=\"padding-bottom: 5px;\">RM [ "+vo.getPrice()+" ]</div>\n" +
                        "                        <div style=\"padding-bottom: 5px;\">RM [ "+vo.getSellPrice()+" ]</div>\n" +
                        "                        <div>RM [ "+vo.getBuyunit()+" ]</div>\n" +
                        "                    </td>\n" +
                        "                    <td style=\"border: none; text-align: right; padding-right: 10px;\">\n" +
                        "                        RM [ "+vo.getAllMoney()+" ]\n" +
                        "                    </td>\n" +
                        "                </tr>\n";
                sb.append(str);
            }
        }

        return sb.toString();
    }

    /**
     * 供应商拒收采购订单，系统发送 “供应商接受采购订单” 邮件给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getSupplierProcessPurchaseOrder(String to){
        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Supplier  company_name  process purchase order order_no .");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                        "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                        "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                        "        <div style=\"width: 70%;\">\n" +
                        "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                        "                Supplier <span style=\"color: #54af9a;\"> company_name </span> has <span style=\"color: #f5537f;\">process</span> purchase order <span style=\"color: #54af9a;\"> order_no </span>\n" +
                        "            </span>\n" +
                        "        </div>\n" +
                        "    </div>\n" +
                        "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                        "        <p>Hi <strong> admin_name ,</strong></p>\n" +
                        "        <br>\n" +
                        "        <p>Supplier <strong> company_name </strong> has process the purchase order <strong> order_no </strong>.</p>\n" +
                        "        <p>You may view the details of the purchase order in the system.</p>\n" +
                        "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                        "        <br>\n" +
                        "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                        "        <br>\n" +
                        "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                        "        \n" +
                        "    </div>\n" +
                        "</div>");
        return mailMessage;
    }

    /**
     * 供应商拒收采购订单，系统发送 “供应商(卖家)拒收采购订单” 邮件给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getSupplierRejectPurchaseOrder(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Supplier  company_name  rejected purchase order  order_no .");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                Supplier <span style=\"color: #54af9a;\"> company_name </span> has <span style=\"color: #f5537f;\">reject</span> purchase order <span style=\"color: #54af9a;\"> order_no </span>\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong> admin_name ,</strong></p>\n" +
                "        <br>\n" +
                "        <p>Supplier <strong> company_name </strong> has rejected the purchase order <strong>[ purchase_order_no ]</strong>.</p>\n" +
                "        <p>You may view the details of the purchase order in the system.</p>\n" +
                "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");
        return mailMessage;
    }

    /**
     * needCheck（当公司额度发生更改的时候；需要管理员接收到该邮件；如果没有需要触发）//ok
     * 公司额度更改，系统发送 “公司额度更改” 邮件给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getCompanyCreditModified(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Credit company  company_name  was modified by  other_admin_name .");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                Credit company <span style=\"color: #54af9a;\"> company_name </span> was modified by <span style=\"color: #54af9a;\"> other_admin_name </span>\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong> admin_name ,</strong></p>\n" +
                "        <br>\n" +
                "        <p>User <strong> other_admin_name </strong> has modified the credit of company <strong> company_name </strong>.</p>\n" +
                "        <table style=\"width: 80%; margin: auto; text-align: left;\">\n" +
                "            <tr><th>Previous credit</th><th>Current credit</th></tr>\n" +
                "            <tr><td>previous_credit</td><td>current_credit</td></tr>\n" +
                "        </table>\n" +
                "        <a href= systemUrl style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");

        return mailMessage;
    }

    /**
     * needCheck（卖家上传新产品的时候需要触发该邮件）//ok
     * 上传新产品，系统发送 “上传新产品” 邮件给管理员
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getNewProductUploaded(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("A new product has been uploaded.");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                "    <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                "    <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "        <div style=\"width: 70%;\">\n" +
                "            <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "                A new product has been uploaded <span style=\"color: #54af9a;\"></span>\n" +
                "            </span>\n" +
                "        </div>\n" +
                "    </div>\n" +
                "    <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "        <p>Hi <strong> admin_name ,</strong></p>\n" +
                "        <br>\n" +
                "        <p>Supplier <strong> company_name </strong> has uploaded a new product <strong> product_name </strong>. Please view the details of the product for further approval action.</p>\n" +
                "        <table style=\"width: 80%; margin: auto; text-align: left;\">\n" +
                "            <tr><th>Product name</th><th>Category</th><th>Sub category</th><th>Description</th><th>Brand</th></tr>\n" +
                "            <tr><th> product_name </th><th> CATE_GORY </th><th>SUB_CATEGORY</th><th>product_description</th><th>product_brand</th></tr>\n" +
                "        </table>\n" +
                "        <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> SYSTEM_URL </a>\n" +
                "        <br>\n" +
                "        <p>Please contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for system enquiry.</p>\n" +
                "        <br>\n" +
                "        <p>From,<br><strong>Airena Procure System</strong></p>\n" +
                "        \n" +
                "    </div>\n" +
                "</div>");

        return mailMessage;
    }
}
